<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <style>
        
    </style>
</head>
<body>
    
</body>
<script>

    // 直接转，类似于给数据套了个引号
    // var num = 365;
    // var num = 365.789;
    // var num = -365.789;
    // var str = num.toString();
    // console.log(num);
    // console.log(typeof num);
    // console.log(str);
    // console.log(typeof str);

    // 将数值转换成字符时，可以指定n小数位
    // var num = 365;
    // var num = 365.789;
    // var num = -365.789;
    // var str = num.toFixed(2);
    // console.log(num);
    // console.log(typeof num);
    // console.log(str);
    // console.log(typeof str);

    // 给数据套了个引号
    console.log( String( "hello" ) );
    console.log( String( 123 ) );
    console.log( String( NaN ) );
    console.log( String( true ) );
    console.log( String( false ) );
    console.log( String( undefined ) );
    console.log( String( null ) );
    console.log( String( function(){} ) );
    // 将中括号换成了引号
    console.log( String( [] ) );
    console.log( String( [3,6,4,2,1] ) );
    console.log( String( [true, false] ) );
    console.log( String( [{},{},{}] ) );
    
    // 花括号的对象转成："[object Object]"
    console.log( String( {name:"admin"} ) );
    console.log( String( {} ) );





</script>
</html>